<template>
<div style="padding: 20px">
  <div v-if="$route.query.type==2" style="margin-bottom: 10px;">
    <van-image
        width="100%"
        height="10rem"
        fit="contain"
        :src="detail.coverPlan"
    />
    <p style="margin-top: 10px;color: #999999">
      <van-icon name="underway-o" />活动时间:{{detail.startTime}} - {{detail.endTime}}
    </p>
    <p style="margin-top: 10px;color: #999999">
      <van-icon name="location-o" />活动地点:{{detail.place}}
    </p>
  </div>
  <h3>{{detail.title}}</h3>
  <p style="margin-top: 10px;color: #999999">
    <span style="margin-right: 40px;">
      <van-icon name="notes-o" />{{detail.createTime}}
    </span>
    <span>
      <van-icon name="eye-o" /> {{detail.browse}}
    </span>
  </p>
  <div style="margin-top: 20px;" v-html="detail.content"></div>
</div>
</template>

<script>
import { getHdD,getNewsD } from "@/api/news";

export default {
  name: "ndetail",
  data() {
    return {
      detail:{}
    }
  },
  created() {
    this.getList()
  },
  methods: {
    async getList(){
      let res = null
      if (this.$route.query.type==2){
        res = await getHdD(this.$route.query.id)
      }else {
        res = await getNewsD(this.$route.query.id)
      }
      console.log(res)
      this.detail = res
    }
  }
}
</script>

<style scoped>

</style>
